﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using web.data.entities;
using web.bussines;
using Webdiyer.WebControls.Mvc;
using System.Web.UI;

namespace web.core.Models
{
    public class accountModels
    {
        public static users authenticateUser(string user_name, string password)
        {
            account_service accSvc = new account_service();
            return accSvc.authenticateUser(user_name, password);
        }

        public static users authenticateUserEmail(string email, string password)
        {
            account_service accSvc = new account_service();
            return accSvc.authenticateUserEmail(email, password);
        }

        public static users getUserByID(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getUserByID(id);
        }

        public static List<page> getListPageAccessByUser(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListPageAccessByUser(id);
        }

        public static List<int> getListPageAccessByGroup(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListPageAccessByGroup(id);
        }

        public static bool checkPageAccessByUser(int id, string page_path)
        {
            account_service accSvc = new account_service();
            return accSvc.checkPageAccessByUser(id,page_path);
        }

        public static void changePassword(users user)
        {
            account_service accSvc = new account_service();
            accSvc.changePassword(user);
        }

        public static int createUser(users user)
        {
            account_service accSvc = new account_service();
            return accSvc.createUser(user);
        }

        public static List<users> getListUser(int startRecod, int pageSize,out int total)
        {
            account_service accSvc = new account_service();
            return accSvc.getListUser(startRecod, pageSize,out total);
        }

        public static PagedList<users> getPageListUser(int pageindex, int pagesite, string text_search, int? group_id)
        {
            account_service accSvc = new account_service();
            return accSvc.getPageListUser(pageindex, pagesite, text_search, group_id);
        }

        public static void updateStatusUser(users user)
        {
            account_service accSvc = new account_service();
            accSvc.updateStatusUser(user);
        }

        public static void editUser(users user)
        {
            account_service accSvc = new account_service();
            accSvc.editUser(user);
        }

        public static List<user_group> getListUserGroup()
        {
            account_service accSvc = new account_service();
            return accSvc.getListUserGroup();
        }

        public static void addGroupForUser(int group_id, int user_id)
        {
            account_service accSvc = new account_service();
            accSvc.addGroupForUser(group_id, user_id);
        }

        public static void deleteUserFromGroup(int group_id, int user_id)
        {
            account_service accSvc = new account_service();
            accSvc.deleteUserFromGroup(group_id, user_id);
        }

        public static void deleteAllGroupOfUser(int user_id)
        {
            account_service accSvc = new account_service();
            accSvc.deleteAllGroupOfUser(user_id);
        }

        public static PagedList<user_group> getPageListGroup(int pageindex, int pagesite, string text_search)
        {
            account_service accSvc = new account_service();
            return accSvc.getPageListGroup(pageindex, pagesite, text_search);
        }

        public static void updateStatusGroup(user_group group)
        {
            account_service accSvc = new account_service();
            accSvc.updateStatusGroup(group);
        }

        public static List<int> getListGroupOfUser(int user_id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListGroupOfUser(user_id);
        }

        public static List<page> getListPageByParent(int? id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListPageByParent(id);
        }

        public static List<page> getListPageBuilder(int? id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListPageBuilder(id);
        }

        public static page getPageByID(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getPageByID(id);
        }

        public static PagedList<page> getPagerBuilder(int pageindex, int pagesite, string text_search, int? parent)
        {
            account_service accSvc = new account_service();
            return accSvc.getPagerBuilder(pageindex, pagesite,text_search,parent);
        }

        public static void updateStatusPage(page page)
        {
            account_service accSvc = new account_service();
            accSvc.updateStatusPage(page);
        }

        public static int createPage(page page)
        {
            account_service accSvc = new account_service();
            return accSvc.createPage(page);
        }

        public static void editPage(page page)
        {
            account_service accSvc = new account_service();
            accSvc.editPage(page);
        }

        public static List<user_group> getListGroupBuilder(int? id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListGroupBuilder(id);
        }

        public static int createGroup(user_group group)
        {
            account_service accSvc = new account_service();
            return accSvc.createGroup(group);
        }

        public static user_group getGroupByID(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getGroupByID(id);
        }

        public static void editGroup(user_group group)
        {
            account_service accSvc = new account_service();
            accSvc.editGroup(group);
        }

        public static void deleteAllPageAccessOfGroup(int group_id)
        {
            account_service accSvc = new account_service();
            accSvc.deleteAllPageAccessOfGroup(group_id);
        }

        public static void createAccessPageforGroup(int group_id, string arr_page)
        {
            account_service accSvc = new account_service();
            accSvc.createAccessPageforGroup(group_id,arr_page);
        }

        public static List<page> getListTopPageParent(int id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListTopPageParent(id);
        }

        public static List<page> getListMenuPageByTopPageID(int? id, int user_id)
        {
            account_service accSvc = new account_service();
            return accSvc.getListMenuPageByTopPageID(id,user_id);
        }

        public static HtmlTextWriter getListPageMenuBuilder(int? id, int user_id, string uri)
        {
            account_service accSvc = new account_service();
            return accSvc.getListPageMenuBuilder(id, user_id,uri);
        }

        public static int getTotalMaleEmployee()
        {
            account_service accSvc = new account_service();
            return accSvc.getTotalMaleEmployee();
        }

        public static int getTotalFemaleEmployee()
        {
            account_service accSvc = new account_service();
            return accSvc.getTotalFemaleEmployee();
        }
    }
}